package wli.web.util;

public class TextToHtml {
	StringBuffer sbf;

	public StringBuffer textToHtml(String input) {
		System.out.println("\n\n\n"+input+"\n\n\n");
		sbf = new StringBuffer ();
		if(input == null || input.equals("null") || input.length()<1) {
			
		}
		else {
			
			if (input.indexOf("<") != -1) {
				input = input.replaceAll("<", "&lt;");
			}
			if (input.indexOf(">") != -1) {
				input = input.replaceAll("<", "&gt;");
			}
			
			if(input.indexOf("\n") != -1) {
				input = input.replaceAll("\n", "<br>");
			}
			
			sbf.append(input);
		}
		return sbf;
	}
}
